/**
 * 论文盲审-接口文件
 */
import fetch from 'common/src/utils/fetch';
import UTILS from "common/src/utils/utils";
import moment from "moment";
const baseUrl = "/api/compulsoryservice";

// 论文盲审申请时间设置
export const timeSettingTableList = `${baseUrl}/thesisConcealEvaApplyDateSetting/query`;
// 论文盲审抽取比例设置-培养类别
export const drawRatioCatoryTableList = `${baseUrl}/categoryRateSetting/query`;
// 论文盲审抽取比例设置-学院专业
export const drawRatioMajorTableList = `${baseUrl}/majorRateSetting/query`;
// 论文盲审抽取比例设置-导师
export const drawRatioTutorTableList = `${baseUrl}/tutorRateSetting/query`;
// 论文盲审抽取比例设置-必抽名单
export const drawRatioStudentTableList = `${baseUrl}/stuRateSetting/query`;
// 文件上传公共接口
export const commonUpload = `/api/commonservice/obsfile/uploadfile`;
// 论文盲审评审控制开关列表查询接口
export const switchTableList = `${baseUrl}/thesisConcealEvaSetting/query`;
// 论文盲审隐名评审结果查询
export const resultTableList = `${baseUrl}/thesisConcealEvaApplyInfoT/queryResult`;
// 论文盲审-导师审批列表查询
export const tutorAuditTableList = `${baseUrl}/thesisConcealEvaApproval/queryTutorApprovalList`;
// 论文盲审-盲审专员审核列表查询
export const adminAuditTableList = `${baseUrl}/thesisConcealEvaApproval/queryAttachApprovalList`;
// 论文盲审-评审查询
export const reviewResultTableList = `${baseUrl}/thesisConcealEvaApplyInfoT/queryBlind`;

// 论文隐名评审-评审查询
export const queryGradeList = `${baseUrl}/thesisAnonymousQuery/queryGrade`;

//论文盲审申请时间设置-新增、修改
export function timeSettingAdd(data) {
  return fetch({
      url: `${baseUrl}/thesisConcealEvaApplyDateSetting/addOrEdit`,
      method: 'post',
      data
  })
}

//论文盲审申请时间设置-获取详情
export function timeSettingGetDetail(data) {
  return fetch({
      url: `${baseUrl}/thesisConcealEvaApplyDateSetting/getDetail?id=${data}`,
      method: 'get',
  })
}

//论文盲审申请时间设置-删除
export function timeSettingDelete(data) {
  return fetch({
      url: `${baseUrl}/thesisConcealEvaApplyDateSetting/delete`,
      method: 'delete',
      data
  })
}

//论文盲审抽取比例设置-列表新增（全量数据新增）
export function drawRatioAdd(data) {
  return fetch({
      url: `${baseUrl}/extractRateSetting/addInfo`,
      method: 'post',
      data
  })
}
//论文盲审抽取比例设置-新增-类别
export function categoryAdd(data) {
  return fetch({
      url: `${baseUrl}/categoryRateSetting/add`,
      method: 'post',
      data
  })
}
//论文盲审抽取比例设置-新增-专业
export function majorAdd(data) {
  return fetch({
      url: `${baseUrl}/majorRateSetting/add`,
      method: 'post',
      data
  })
}
//论文盲审抽取比例设置-新增-导师
export function tutorAdd(data) {
  return fetch({
      url: `${baseUrl}/tutorRateSetting/add`,
      method: 'post',
      data
  })
}
//论文盲审抽取比例设置-新增-学生
export function studentAdd(data) {
  return fetch({
      url: `${baseUrl}/stuRateSetting/add`,
      method: 'post',
      data
  })
}

/**
 * 查询学生列表信息
 */
export function findStudentList(data) {
  return fetch({
    url: '/api/studentservice/studentInfo/findAllStuInfoList',
    method: 'post',
    data
  });
}

//论文盲审抽取比例设置-编辑-学生
export function studentEdit(data) {
  return fetch({
      url: `${baseUrl}/stuRateSetting/update`,
      method: 'put',
      data
  })
}
//论文盲审抽取比例设置-编辑-导师
export function tutorEdit(data) {
  return fetch({
      url: `${baseUrl}/tutorRateSetting/update`,
      method: 'put',
      data
  })
}
//论文盲审抽取比例设置-编辑-专业
export function majorEdit(data) {
  return fetch({
      url: `${baseUrl}/majorRateSetting/update`,
      method: 'put',
      data
  })
}
//论文盲审抽取比例设置-编辑-类别
export function categoryEdit(data) {
  return fetch({
      url: `${baseUrl}/categoryRateSetting/update`,
      method: 'put',
      data
  })
}

//论文盲审抽取比例设置-获取详情-类别
export function categoryGetDetail(data) {
  return fetch({
      url: `${baseUrl}/categoryRateSetting/getDetail?id=${data}`,
      method: 'get',
  })
}
//论文盲审抽取比例设置-获取详情-专业
export function majorGetDetail(data) {
  return fetch({
      url: `${baseUrl}/majorRateSetting/getDetail?id=${data}`,
      method: 'get',
  })
}
//论文盲审抽取比例设置-获取详情-导师
export function tutorGetDetail(data) {
  return fetch({
      url: `${baseUrl}/tutorRateSetting/getDetail?id=${data}`,
      method: 'get',
  })
}
//论文盲审抽取比例设置-获取详情-学生
export function studentGetDetail(data) {
  return fetch({
      url: `${baseUrl}/stuRateSetting/getDetail?id=${data}`,
      method: 'get',
  })
}

//论文盲审抽取比例设置-删除-学生
export function studentDelete(data) {
  return fetch({
      url: `${baseUrl}/stuRateSetting/delete`,
      method: 'delete',
      data
  })
}
//论文盲审抽取比例设置-删除-导师
export function tutorDelete(data) {
  return fetch({
      url: `${baseUrl}/tutorRateSetting/delete`,
      method: 'delete',
      data
  })
}
//论文盲审抽取比例设置-删除-专业
export function majorDelete(data) {
  return fetch({
      url: `${baseUrl}/majorRateSetting/delete`,
      method: 'delete',
      data
  })
}
//论文盲审抽取比例设置-删除-类别
export function categoryDelete(data) {
  return fetch({
      url: `${baseUrl}/categoryRateSetting/delete`,
      method: 'delete',
      data
  })
}

//论文盲审抽取比例设置-预评审控制开关-查询详情
export function switchGetDetail(data) {
  return fetch({
      url: `${baseUrl}/thesisConcealEvaSetting/getDetail?id=${data}`,
      method: 'get',
  })
}

//论文盲审抽取比例设置-预评审控制开关-删除
export function switchDelete(data) {
  return fetch({
      url: `${baseUrl}/thesisConcealEvaSetting/delete`,
      method: 'delete',
      data
  })
}

//论文盲审抽取比例设置-预评审控制开关-新增/编辑
export function switchAddOrEdit(data) {
  return fetch({
      url: `${baseUrl}/thesisConcealEvaSetting/addOrEdit`,
      method: 'post',
      data
  })
}

//论文盲审申请-获取列表信息
export function applyTableList(data) {
  return fetch({
      url: `${baseUrl}/thesisConcealEvaApplyInfoT/query`,
      method: 'post',
      data
  })
}

//论文盲审申请-获取评审控制开关信息
export function applyGetSwitchInfo(data) {
  return fetch({
      url: `${baseUrl}/thesisConcealEvaSetting/query`,
      method: 'post',
      data
  })
}

//论文盲审申请-盲审申请
export function applyAddOrEdit(data) {
  return fetch({
      url: `${baseUrl}/thesisConcealEvaApplyInfoT/addOrEdit`,
      method: 'post',
      data
  })
}

//论文盲审申请-申请回显数据
export function applyGetdetail(data) {
  return fetch({
      url: `${baseUrl}/thesisConcealEvaApplyInfoT/getDetail?applyId=${data}`,
      method: 'get',
  })
}

//论文盲审申请-抽盲接口
export function applyManualRate(data) {
  return fetch({
      url: `${baseUrl}/thesisConcealEvaApplyInfoT/manualRate?applyId=${data}`,
      method: 'get',
  })
}

//论文盲审申请-查看/录入详情
export function applyEnterDetail(row) {
  return fetch({
      url: `${baseUrl}/thesisConcealEvaApplyInfoT/enterDetail?applyId=${row.applyId}${row.resultId?"&resultId="+row.resultId:""}`,
      method: 'get',
  })
}

//论文盲审评审结果-导出
export function resultTableExportTable(data, ) {
  return fetch({
      url: `${baseUrl}/thesisConcealEvaApplyInfoT/exportTable`,
      method: 'post',
      responseType: "blob",
      data,
      timeout: 0
  }).then(res => {
    UTILS.downloadFile(
      res,
      `论文隐名评审.xls`,
      "application/vnd.ms-excel;charset=utf-8"
    );
  });
}

//论文盲审评审结果-录入结果
export function reviewResultInput(data) {
  return fetch({
      url: `${baseUrl}/thesisConcealEvaApplyInfoT/enterResult`,
      method: 'post',
      data
  })
}

//论文盲审导师审核-查看详情
export function tutorAuditDetail(data) {
  return fetch({
      url: `${baseUrl}/thesisConcealEvaApproval/getDetail?applyId=${data}`,
      method: 'get',
  })
}

//论文盲审导师审核-修改论文研究方向
export function tutorAuditEdit(data) {
  return fetch({
      url: `${baseUrl}/thesisConcealEvaApproval/editThesisResearchField`,
      method: 'put',
      data
  })
}

//论文盲审导师审核-确认研究方向、内容、格式
export function tutorAuditConfirm(data) {
  return fetch({
      url: `${baseUrl}/thesisConcealEvaApproval/confirmThesisStatus`,
      method: 'put',
      data
  })
}

//论文盲审盲审专员审核-单个记录编辑保存（单个送审）
export function adminAuditUpadte(data) {
  return fetch({
      url: `${baseUrl}/thesisConcealEvaApproval/updateInfo`,
      method: 'put',
      data
  })
}

//论文盲审盲审专员审核-批量送审
export function adminAuditBatchCheck(data) {
  return fetch({
      url: `${baseUrl}/thesisConcealEvaApproval/batchEva`,
      method: 'put',
      data
  })
}

//论文盲审盲审专员审核-盲审专员导出
export function adminAuditExport(data) {
  return fetch({
      url: `${baseUrl}/thesisConcealEvaApproval/export`,
      method: 'post',
      responseType: "blob",
      data,
      timeout: 0
  }).then(res => {
    UTILS.downloadFile(
      res,
      "论文信息汇总表.xls",
      "application/vnd.ms-excel;charset=utf-8"
    );
  });
}

//论文盲审盲审专员审核-盲审专员下载
export function adminAuditDownloadZip(data) {
  let param = JSON.stringify(data);
  window.open(`${baseUrl}/thesisConcealEvaApproval/downloadZip?param=` + param);
  // return fetch({
  //     url: `${baseUrl}/thesisConcealEvaApproval/downloadZip`,
  //     method: 'post',
  //     responseType: "blob",
  //     data,
  //     timeout: 0
  // }).then(res => {
  //   UTILS.downloadFile(
  //     res,
  //     `10247_${moment().format('YYYYMMDDHHmmss')}.zip`,
  //     "application/x-zip-compressed;charset=utf-8"
  //   );
  // });
}

// 公共下载单文件方法
export function commonDownload(key, fileName, fileType) {
  return fetch({
      url: `/api/commonservice/obsfile/downloadfile?objectkey=${key}`,
      method: 'get',
      responseType: "blob",
      timeout: 0
  }).then(res => {
    UTILS.downloadFile(
      res,
      fileName,
      fileType
    );
  });
}

//论文盲审盲审-评审查询-导出
export function reviewResultExport(data) {
  return fetch({
      url: `${baseUrl}/thesisConcealEvaApplyInfoT/exportBlind`,
      method: 'post',
      responseType: "blob",
      data,
      timeout: 0
  }).then(res => {
    UTILS.downloadFile(
      res,
      "评审查询列表.xls",
      "application/vnd.ms-excel;charset=utf-8"
    );
  });
}

//论文隐名评审查询-评审查询-导出
export function gradeExport(data) {
  return fetch({
    url: `${baseUrl}/thesisAnonymousQuery/exportGrade`,
    method: 'post',
    responseType: "blob",
    data,
    timeout: 0
  }).then(res => {
    UTILS.downloadFile(
      res,
      "论文隐名评审查询列表.xls",
      "application/vnd.ms-excel;charset=utf-8"
    );
  });
}

//论文盲审导师审批
export function tutorCheck(data) {
  return fetch({
      url: `${baseUrl}/thesisConcealEvaApplyInfoT/tutorCheck`,
      method: 'post',
      data
  })
}

//论文盲审-盲审专员设置特殊需要通过篇数
export function specialSetting(data) {
  return fetch({
      url: `${baseUrl}/thesisConcealEvaApproval/specialSetting`,
      method: 'put',
      data
  })
}

// 论文盲审评审查询-详情获取评审结果
export function reviewGetList(data) {
  return fetch({
      url: `${baseUrl}/thesisConcealEvaApplyInfoT/queryResult`,
      method: 'post',
      data
  })
}
